package com.fau.wmbj.server.entity;

import com.vladmihalcea.hibernate.type.json.JsonStringType;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.Type;
import org.hibernate.annotations.TypeDef;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Map;

/**
 * 商品
 *
 * @author jiawei
 * @version 1.0
 * @datetime 2024-03-06 16:13
 */
@Getter
@Setter
@Entity(name = "f_goods")
@TypeDef(name = "json", typeClass = JsonStringType.class)
public class Goods extends BaseEntity<Long> implements Serializable {

    /**
     * 商品名称
     */
    @Column(name = "name", nullable = false)
    private String name;

    /**
     * 规格
     */
    @Column(name = "specifications")
    @Type(type = "json")
    private Map<String, Object> specifications;


    /**
     * 所属公司
     */
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "company_id")
    private Company company;

}
